package com.zl.tesseract.scanner.app;

import android.app.Application;
import android.content.Context;

import com.tencent.bugly.crashreport.CrashReport;
import com.zl.tesseract.scanner.baiduai.BaiduAuthService;
import com.zl.tesseract.scanner.fit.Density;
import com.zl.tesseract.scanner.greendao.GreenDaoHelper;
import com.zl.tesseract.scanner.loop.MyThreadPool;

public class MyApplication extends Application {

    public static Context sAppContext;

    @Override
    public void onCreate() {
        super.onCreate();
        sAppContext = this;

        CrashReport.initCrashReport(getApplicationContext(), "1296235a6c", false);

        // 申请百度鉴权
        MyThreadPool.getInstance().execute(new Runnable() {
            @Override
            public void run() {
                AuthPreferences.saveBaiduToken(BaiduAuthService.getAuth());
            }
        });

        // 初始化greendao
        GreenDaoHelper.initDatabase();

        /**
         * 多屏幕适配
         */
        Density.setDensity(this, 752f);
    }
}
